home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sticpsrc.lzh / DOC / ENVIRON.ARC / ENVIRON.DOC next >
Text File  |  1989-03-05  |  7KB  |  188 lines

  1. 06601030305800
  2. ⇧
  3. ⇩#
  4. F0110030
  5. 9[...................................................]001
  6. êEnvironmentvariablesinNETÇ
  7.  
  8. ByRobJanssen,PE1CHL.
  9.  
  10. NEThasbeenenhancedwithsupportforvariables.Thismeansyou
  11. cansetvariablestosome(string)value,andusethesevaluesin
  12. commands.Thisisespeciallyusefulintheconfigurationfiles.
  13. Also,somevariablenamesarereservedtoholdthenamesofthe
  14. differentdirectoriesandfilesreferencedbyNET,sothatyou
  15. cannowlocatethesewhereveryoulike.
  16.  
  17.  
  18. êsetenvcommandÇ
  19.  
  20. Variablesaresetusingthe"setenv"commandinNET.The
  21. possibleusesare:
  22.  
  23. setenv
  24. setenvwithoutparametersdisplaysthecurrentlydefined
  25. variables,inalphabeticorder,withtheirvalues.
  26.  
  27. setenvnamevalue
  28. thevariable"name"isgiven"value"asit'svalue.the
  29. previousvalueof"name"islost,andthevariableis
  30. createdautomaticallyifitdidnotyetexist.
  31.  
  32. setenvname
  33. thevariable"name"losesit'svalueandwillnotbe
  34. displayedby"setenv"anymore.thisisdifferentfrom
  35. assigninganemptyvaluetothevariable,whichcanbedone
  36. using:setenvname"".
  37.  
  38. setenvname=value
  39. thisformisallowedasanalternativetothesecondcase.
  40.  
  41. Thenameofavariablecancontainletters,digitsandthe
  42. underscorecharacter,anditisalwaysconvertedtoUPPERCASE
  43. beforeitisstoredorreferenced.
  44.  
  45. Afteravariablehasbeenassignedusingsetenv(orothermeans,
  46. seebelow),itcanbeusedin2basicallydifferentways:
  47.  
  48. ê1.ImplicitlyusedbyNETÇ
  49.  
  50. Whenthenameofthevariableisoneofthereservednames,NET
  51. willautomaticallyuseit.Itisgenerallyunwisetosetthese
  52. reservedvariablestoemptyornonsensevalues,asthismaycause
  53. problemsintheoperationofNET.
  54.  
  55. Thereservednamesare:
  56.  
  57. NETSTART       Initialization file
  58. NETUSERS       Authorized FTP users and passwords
  59. NETHOSTS       Network host table
  60. ÇNETFINGER      Finger file path
  61. NETMAILS       Incoming mail
  62. NETMAILQ       Outgoing mail spool
  63. NETROUTEQ      Queue for router
  64. NETALIAS       The alias file
  65.  
  66. And,ontheAtariST:
  67. TMPDIR         Temp files directory
  68.  
  69. So,byusingthecommand"setenvNETHOSTSd:\hosts.net",you
  70. changethenameofthehostsfileto"d:\hosts.net",andifthis
  71. isonaRAM-diskthelookupofhostnameswillbesomewhatfaster.
  72.  
  73.  
  74. ê2.ExplicituseinaNETcommandÇ
  75.  
  76. AvariablecanbeusedineveryNETcommandinsteadof(partsof)
  77. acommandnameoraparameter.Variablesarereferencedusing
  78. the$signfollowedbytheirname,asin:
  79.  
  80. attachnetrom$CALLSIGN
  81.  
  82. Inthiscase,$CALLSIGNisreplacedbythecontentsofthe
  83. variableCALLSIGNbeforethecommandisexecuted.Avariablecan
  84. alsocontainpartofaparameter,asin:
  85.  
  86. attachasy3f84ax25ax05122564800$CALLSIGN-2
  87.  
  88. Inthiscase,the-2ssidwillbeappendedtothecallsignstored
  89. inthevariableCALLSIGN.
  90.  
  91. Whenthetexttobeappendedcouldbemistakenforpartofthe
  92. variablename,thenamecanbeenclosedinbraces:${VARNAME}000.
  93.  
  94. Therealsoexistsomemoreadvancedwaysofreferencing
  95. variables,tomakeitpossibletoprovidedefaultsforundefined
  96. ones:
  97.  
  98. ${NAME-default}
  99. ThiswillreturnthevalueofthevariableNAMEifitis
  100. defined,or"default"ifNAMEisundefined.
  101.  
  102. ${NAME=default}
  103. Actsthesameasthepriviouscase,butitadditionallysets
  104. thevariableNAMEtovalue"default"ifitdidnotexist.
  105.  
  106. ${NAME?text}
  107. WhenNAMEisdefined,returnsit'svalue.Ifnot,itprints
  108. "text"andthecommandlineisnotexecuted.When"text"is
  109. notpresent,"undefinedvariable"isprinted.
  110.  
  111. ${NAME+text}
  112. WhenNAMEisdefined,returns"text".WhenNAMEisnot
  113. defined,returnsanemptystring.
  114. Ç
  115.  
  116.  
  117. êInitialsettingofvariablesÇ
  118.  
  119. ThevalueofvariablesatthetimeNETisstartedisdetermined
  120. asfollows:
  121.  
  122. 1.WhenNETisstarted,thevariabletableisempty.Itfirst
  123. insertsdedefaultvaluesofthe"reserved"variablesinto
  124. thetable.Thevaluesarethepathnamesthatusedtobe
  125. fixedinearlierreleases,e.g.:
  126. NETMAILQ=/spool/mqueue/
  127.  
  128. 2.Thevariablesintheenvironmentpassedbytheoperating
  129. systemareaddedtothetable,possiblyreplacingthe
  130. defaults.Thismeansavariablecanbegivenaninitial
  131. valuebyputtingitintheenvironmentoftheshellthat
  132. startsNET(inMS-DOS:usingaSETcommandinCOMMAND.COM)
  133.  
  134. 3.ParameterstotheNETprogramoftheform"name=value"are
  135. parsedas"setenv"commands.Thiscontinuesfromleftto
  136. rightuntilaparameterisencounteredthatdoesnotcontain
  137. an"="sign,orallparametershavebeenparsed.
  138.  
  139. 4.NETperformsinternalinitializations,thatpossiblyusethe
  140. variablesdefineduptothismoment.Thereafteritprints
  141. thebanner.
  142.  
  143. 5.Whentherearenomoreparameters,thefilewhosenameisin
  144. thevariableNETSTARTisexecutedasacommandfile.
  145. NormallythiswillbeAUTOEXEC.NET.
  146. Ifthereareparametersleftatthispoint,theyare
  147. examinedfromlefttoright.Iftheydon'tcontainan"="
  148. signtheyareassumedtobefilenamesandexecutedasa
  149. commandfile,iftheydocontainan"="theyareparsedas
  150. "setenv"commands.
  151.  
  152. 6.ThepromptisprintedandNETstartsoperating
  153. interactively.
  154.  
  155. ExampleofaNETcommandlines:
  156.  
  157. netcallsign=pe1chlautoexec.st2running=1
  158.  
  159. ThisstartsNETwithvariableCALLSIGNsettovalue"pe1chl",
  160. thenNETreadsthestartupfile"autoexec.st2"andafterthisfile
  161. hasbeencompletelyexecuted,variableRUNNINGissetto1.
  162.  
  163. netcallsign=pe1chl
  164.  
  165. Sameasabove,butthedefaultstartupfiledefinedinNETSTART
  166. isexecutedwithvariableCALLSIGNsetto"pe1chl".
  167. Notethatinthiscaseitisstillpossibletorunanonstandard
  168. Çstartupfileifyoudefineit'snameintheenvironmentofthe
  169. shell.ForMS-DOSthiscanbedonebytyping
  170.  
  171. setnetstart=autoexec.2
  172.  
  173. fromtheCOMMAND.COMprompt.
  174.  
  175.  
  176.  
  177. êEnvironmentpassedtosub-shellsÇ
  178.  
  179. WhenNETstartsasub-shell(usingthecommand"shell"or"!"),
  180. itpassesthevaluesofallvariablesasanenvironmenttothis
  181. sub-shell.Asitreadsintheenvironmentitselfduringstartup,
  182. thispassedenvironmentatleastcontainstherequiredvariables
  183. foreveryexecutedshell.
  184. Butasitalsocontainsthevariablesthatyoucansetyourself,
  185. thisfeaturecanbeusedtodefinetheenvironmentforamailer
  186. runfromNET,usingsetenvcommandsinthestartupfile.
  187.  
  188.